#! /bin/sh

# execute this script from the top-level directory
HOSTNAME=${HOSTNAME:-`hostname`}
VARIANT=${VARIANT:-32}
DIRNAME=$HOSTNAME-$VARIANT

CC=icc
CXX="icc -Kc++"
F77=ifort
F90=ifort
FC=ifort
FFLAGS="-O3 -WB -xT"
F90FLAGS="-O3 -WB -xT"
FCFLAGS="-O3 -WB -xT"
CFLAGS="-no-gcc -O3 -xT"
CXXFLAGS="-no-gcc -O3 -xT"

BENCH=/home/stevenj/cvs/nbenchfft

CPPFLAGS="-I/opt/intel/mkl/8.1/include -I/opt/intel/ipp/5.1/ia32/include -I/homes0/stevenj/ibench/include"
LDFLAGS="-L/homes0/stevenj/ibench/lib -L/opt/intel/ipp/5.1/ia32/sharedlib -L/opt/intel/mkl/8.1/lib/32"

MAKE=make

OMP_NUM_THREADS=1

export CC CXX F77 F90 FC LDFLAGS CFLAGS FFLAGS F90FLAGS FCFLAGS CPPFLAGS CXXFLAGS MAKE OMP_NUM_THREADS

LD_LIBRARY_PATH=/opt/intel/ipp/5.1/ia32/sharedlib/:/opt/intel/mkl/8.1/lib/32
export LD_LIBRARY_PATH

. /opt/intel/cc/9.1.043/bin/iccvars.sh
. /opt/intel/fc/9.1.037/bin/ifortvars.sh

rm -rf $DIRNAME
mkdir $DIRNAME

( 
  cd $DIRNAME
  $BENCH/configure --disable-single --with-f90
  $MAKE -k; $MAKE -k benchmark; make clean
  $BENCH/configure --enable-single --with-f90
  $MAKE -k; $MAKE -k benchmark; make clean
  $BENCH/configure --disable-single --with-f90
  $MAKE -k; nice -20 $MAKE -k accuracy; make clean
  $BENCH/configure --enable-single --with-f90
  $MAKE -k; nice -20 $MAKE -k accuracy; make clean
  make collect OUTFILE=$DIRNAME
)
